/*
 * @Author: zdc 3215400595@qq.com
 * @Date: 2023-07-29 19:16:25
 * @LastEditors: zdc 3215400595@qq.com
 * @LastEditTime: 2023-07-29 19:16:26
 * @FilePath: /Use_of_technology/proxy/proxy.cpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*房东要把⼀个房⼦通过中介租出去理解代理模式*/
#include <iostream>
#include <string>

class RentHouse
{
public:
    virtual void rentHouse() = 0;
};

/*房东类：将房⼦租出去*/
class Landlord : public RentHouse
{
public:
    void rentHouse()
    {
        std::cout << "将房⼦租出去\n";
    }
};

/*中介代理类：对租房⼦进⾏功能加强，实现租房以外的其他功能*/
class Intermediary : public RentHouse
{

public:
    void rentHouse()
    {
        std::cout << "发布招租启⽰\n";
        std::cout << "带⼈看房\n";
        _landlord.rentHouse();
        std::cout << "负责租后维修\n";
    }

private:
    Landlord _landlord;
};

int main()
{
    Intermediary intermediary;
    intermediary.rentHouse();
    return 0;
}